import 'dart:async';
import 'package:get/get.dart';
import 'package:scanner/common/assets.dart';
import 'package:scanner/generated/assets.dart';
import 'dart:developer';
import 'package:scanner/models/wj_tab_model.dart';

class WJTabLogic extends GetxController {


  static WJTabLogic? find() {
    try {
      return Get.find<WJTabLogic>();
    } catch (e) {
      log('WJTabLogic find error:$e');
    }
    return null;
  }

  bool fromGuide = false;

  /// 输入法深度链接
  StreamSubscription? _appLinkSub;

  // 当前 tab 下标
  int currentTabIndex = 0;

  List<WJTabModel> tabList = [];




  // 点击 tab
  void tapTab(int index) {
    if (index != currentTabIndex) {
      currentTabIndex = index;
      update(); // 通知界面更新
    }
  }





  @override
  void onInit() {
    super.onInit();
    print("ssss${Assets.assetsIconMainTab01N}");


  tabList = [
    WJTabModel(Assets.assetsIconMainTab01N, Assets.assetsIconMainTab01N, '首页'),
    WJTabModel(Assets.assetsIconMainTab01N, Assets.assetsIconMainTab01N, '人设商店'),
    WJTabModel(Assets.assetsIconMainTab01N, Assets.assetsIconMainTab01N, '我的')
  ];


  }




  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {
    _appLinkSub?.cancel(); // 记得销毁 StreamSubscription

    super.onClose();
  }
}
